package cn.yunhe.servlet;

import cn.yunhe.bean.HotelPrice;
import cn.yunhe.biz.HotelBackService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
@WebServlet("/GetBackHotelRoomTypeServlet")
public class GetBackHotelRoomTypeServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        HotelBackService hotelBackService = new HotelBackService();
        List<HotelPrice> hotelPriceList = hotelBackService.getAllHotelRoom();
        req.setAttribute("hotelPriceList",hotelPriceList);
        if(hotelPriceList!=null && hotelPriceList.size()>0){
            req.getRequestDispatcher("hotelPrice.jsp").forward(req,resp);
        }
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }
}
